﻿using Kimd.Common;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Kimd.Communication
{
    public class SerialPortConfig
    {
        [DisplayName("串口"), Category("串口属性")]
        public string PortName { get; set; } = "COM3";
        [DisplayName("波特率"), Category("串口属性")]
        public int BaudRate { get; set; } = 9600;
        [DisplayName("校验位"), Category("串口属性")]
        public Parity Parity { get; set; } = Parity.None;
        [DisplayName("数据位"), Category("串口属性")]
        public int DataBits { get; set; } = 8;
        [DisplayName("停止位"), Category("串口属性")]
        public StopBits StopBits { get; set; } = StopBits.One;
        [Browsable(false)]
        public SerializableDictionary<string, string> SendCmd { get; set; } = new SerializableDictionary<string, string>();
        [DisplayName("接收编码规则"), Category("字符串")]
        public EncodingEnumStr ReceiveEncoding { get; set; } = EncodingEnumStr.Default;
        [DisplayName("发送编码规则"), Category("字符串")]
        public EncodingEnumStr SendEncoding { get; set; } = EncodingEnumStr.Default;
    }
}
